require.config({
	 paths: {
    'jquery': '/js/packages/jquery-2.14-min',
    'bootstrap': '/bootstrap/js/bootstrap.min',
  },
  shim: {
    'bootstrap': {
      deps: ['jquery'],
      exports: 'bootstrap'
    }
  }
});

require(['jquery','bootstrap'], function ($) {
	
	$('#login-start').click(function(){
		var jsonData = {};
		jsonData['account'] = $('#username').val();
		jsonData['password'] = $('#password').val();
		
		
		$.post('/users/login',jsonData,
		function(data,status){
			if(data.data=="用户已登陆") {
				window.location.href="/search/form.html";
			}else {
				alert(data.data);
			}
		});
	});
	$('#register-start').click(function(){
		if($('#passwordsignup').val()!=$('#passwordsignup_confirm').val()) {
			alert("密码不一致");
			return;
		}
		var jsonData = {};
		jsonData['account'] = $('#usernamesignup').val();
		jsonData['password'] = $('#passwordsignup').val();
		
		
		$.post('/users/register',jsonData,
		function(data,status){
			//console.log(data)
			alert(data.data)
		});
	});

});